package com.desheng.j2ee.action.controller;

import com.desheng.j2ee.action.service.IHelloService;
import com.desheng.j2ee.mvcframework.annotation.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@DSController
@DSRequestMapping("/hello")
public class HelloController {

    @DSAutowired
    private IHelloService helloService;


    @DSRequestMapping(value = "/query", method = DSRequestMethod.GET)
    public void query(HttpServletRequest req, HttpServletResponse resp,
                      @DSRequestParam("name") String name, @DSRequestParam("id") int id) {
        String result = helloService.get(name) + "--->" + id;
        try {
            resp.getWriter().write(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
